# -*- coding: utf-8 -*-
"""
Created on Thu Nov 17 22:30:01 2022

@author: YSL
"""
for i in range(4,1001):
    num_all=[0]*1001
    for j in range(1,i):
        if i%j==0:
            num_all[j]=j
        if i==pow(j,2):
            num_all[0]=j

    sum=0
    for j in range(i):
        sum+=num_all[j]
    if sum==i:
        print(i)
        